{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 3 - Spectral Degradation\n", "\n", "**Requirements:**\n", "- spectral irradiance (measured or simulated)\n", "- wavelengths of spectral irradiance data\n", "- module RH\n", "- module temperature\n", "\n", "\n", "**Objectives:**\n", "1. Read in spectral irradiance\n", "2. Calculate spectral degradation" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# if running on google colab, uncomment the next line and execute this cell to install the dependencies and prevent \"ModuleNotFoundError\" in later cells:\n", "# !pip install pvdeg==0.3.3" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\mspringe\\AppData\\Local\\Temp\\1\\ipykernel_40480\\1750438778.py:2: DeprecationWarning: \n", "Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),\n", "(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)\n", "but was not found to be installed on your system.\n", "If this would cause problems for you,\n", "please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466\n", " \n", " import pandas as pd\n" ] } ], "source": [ "import os\n", "import pandas as pd\n", "import numpy as np\n", "import pvdeg\n", "from pvdeg import DATA_DIR" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Working on a Windows 10\n", "Python version 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]\n", "Pandas version 2.2.0\n", "pvdeg version 0.2.4.dev83+ge2ceab9.d20240422\n" ] } ], "source": [ "# This information helps with debugging and getting support :)\n", "import sys, platform\n", "print(\"Working on a \", platform.system(), platform.release())\n", "print(\"Python version \", sys.version)\n", "print(\"Pandas version \", pd.__version__)\n", "print(\"pvdeg version \", pvdeg.__version__)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Read in spectral irradiance data\n", "\n", "Spectral degradation has 4 main requirements:\n", "- Spectral Irradiance [W/m^2 nm]\n", "- Wavelength [nm] \n", "- Module Relative Humidity [%]\n", "- Module Temperature [C]\n", "\n", "For more advanced scenarios, you may want to calculate the degradation of a particular layer within the module. Below, we are using *backside* irradiance and therefore a slightly different temperature and humidity have been calculated. To calculate degradation on the backside, we used `pvdeg.humidity.rh_backsheet`. For the the front side, you should use `pvdeg.humidity.rh_surface_outside` or `rh_front_encap`\n", "\n", "\n", "For this tutorial we are using pre-generated data from a ray-tracing simulation. To calculate the degradation rate, we will need the wavelengths used in the simulation. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SpectraTemperatureRH
timestamp
2021-03-09 10:00:00[0.6892146677599185, 0.40215646494410884, 0.67...4559
2021-03-09 11:00:00[0.15575709102178648, 0.5464374649246564, 0.68...4456
2021-03-09 12:00:00[0.22782105874481207, 0.9056495270031296, 0.26...5939
2021-03-09 13:00:00[0.3741943134512433, 0.035830980984344674, 0.4...4413
2021-03-09 14:00:00[0.40321187996337626, 0.6473167864022122, 0.69...2539
\n", "
" ], "text/plain": [ " Spectra \\\n", "timestamp \n", "2021-03-09 10:00:00 [0.6892146677599185, 0.40215646494410884, 0.67... \n", "2021-03-09 11:00:00 [0.15575709102178648, 0.5464374649246564, 0.68... \n", "2021-03-09 12:00:00 [0.22782105874481207, 0.9056495270031296, 0.26... \n", "2021-03-09 13:00:00 [0.3741943134512433, 0.035830980984344674, 0.4... \n", "2021-03-09 14:00:00 [0.40321187996337626, 0.6473167864022122, 0.69... \n", "\n", " Temperature RH \n", "timestamp \n", "2021-03-09 10:00:00 45 59 \n", "2021-03-09 11:00:00 44 56 \n", "2021-03-09 12:00:00 59 39 \n", "2021-03-09 13:00:00 44 13 \n", "2021-03-09 14:00:00 25 39 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "wavelengths = np.array(range(280,420,20))\n", "\n", "SPECTRA = pd.read_csv(os.path.join(DATA_DIR,'spectra.csv'), header=0, index_col=0)\n", "SPECTRA.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Calculate Degradation\n", "\n", "The spectral degradation function has several optional paramters. For more information, refer to the documentation. Below is a function call with the minimum required information." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Removing brackets from spectral irradiance data\n" ] } ], "source": [ "degradation = pvdeg.degradation.degradation(spectra=SPECTRA['Spectra'],\n", " rh_module=SPECTRA['RH'],\n", " temp_module=SPECTRA['Temperature'],\n", " wavelengths=wavelengths)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" }, "vscode": { "interpreter": { "hash": "14c04630f1cd445b2532d35c77825134bfcafda47af70d0b9c2b5023b1f357a5" } } }, "nbformat": 4, "nbformat_minor": 2 }